function agentSwipSmallDownDetail(isFast) {
    if (isFast == undefined) isFast = false
    if (ENABLE_BLUE_MODE) {
        hid.swip(screen.percentToWidth(0.4), screen.percentToHeight(0.62), screen.percentToWidth(0.6), screen.percentToHeight(0.43), isFast ? 25 : 55, 100, 100)
        return
    }

    if (ENABLE_HID_MODE) {
        Otg.swipe(screen.percentToWidth(0.4), screen.percentToHeight(0.62), screen.percentToWidth(0.6), screen.percentToHeight(0.43), isFast ? 25 : 20, 100, 100)
    } else {
        agent.swip(screen.percentToWidth(0.4), screen.percentToHeight(0.62), screen.percentToWidth(0.6), screen.percentToHeight(0.43), isFast ? 2 : 55, 100, 100)
    }
}


function start_查看产品详情_SAMPLE() {

    log('查看产品详情')
    var flag = ocrWaitForMoreTextMillisecond('优惠团购', '优惠团', '惠团购', '万次', '全部团购', '营业时间')
    if (flag == null) {
        var enterFlag = ocrText('查看详', '看详情')
        if (enterFlag) {
            agentOrHidClick(enterFlag)
        } else {
            click(0.5, 0.5)
        }
        flag = ocrWaitForMoreTextMillisecond('优惠团购', '优惠团', '惠团购', '万次', '全部团购', '营业时间')
    } else {
        sleep.second(5)
    }

    if (flag) {
        // agentOrHidClick(ocrText('仅使用期间允许', '使用期间', '期间允许', '允许本次'))
        agentOrHidClick(ocrText('禁止', '禁', '止', '取消'))

        ocrWaitForMoreTextMillisecond('关注', '评价', '导航', '电话', '立即抢购')

        //找图返回目标数组
        if (getRandomNum(0, 100) > 75) {
            log('点击详情')
            agentOrHidClick(ocrText('详情'), 3, () => {
                ocrWaitForMoreTextMillisecond('详细信息', '营业时间')
                sleep.second(5)
                agentOrHidback()
            })
        }

        // ocrTextTrue('还没有內容')


        // 浏览详情
        if (getRandomNum(0, 100) > 60) {
            log('浏览商品详情')
            // agentOrHidClick(ocrText('全部团购', '全部团', '部团购'))

            agentOrHidClickAbsoultXOffectY(ocrText('抢购'), screen.percentToWidth(0.5), -20)
            sleep.second(5)
            if (ocrWaitForMoreTextMillisecond('直接购买', '收藏', '余额', '抵扣', 10)) {
                // 随机收藏
            }
            reperatAgentSwipSmallDown循环向下浏览(false, 6, 5)

            log('返回商品详情主页')
            backUntilFindView(() => {
                return ocrText('优惠团购', '导航', '营业时间', '全部团购', '参与抢购', '位置权限')
            }, 3)

        }

        var roundTimes = getRandomNum(1, 8)
        log('向下滑动浏览' + roundTimes + '次')
        expectView(() => {
            return ocrText('猜你喜欢', '还没有', '找更多', '用户推荐', '用户评价', '查看商家资质', '平台规则')
        }, () => {
            agentSwipSmallDownDetail()
            sleep.second(6)
        }, null, null, roundTimes)

        // // 随机进店逛逛
        // if (Math.random() * 100 > 80) {
        //     //找图返回目标数组
        //     // ocrText('进店逛逛', true)
        //     agentClickRight(ocrText('进店逛逛', '进店'), 1, () => {
        //         whilestep(() => {
        //             agentSwipDown()
        //         }, 20, 5)

        //         backUntilFindView(() => {
        //             return ocrText('立即', '推荐', '评价')
        //         }, 5)
        //     })
        // }

        // // 加入购物车
        // var detectsggc = opencv.findImagesEx('图色879536.cv');
        // if (detectsggc != null) {
        //     agentOrHidClick(detectsggc[0])


        //     agentOrHidClick(ocrTextInRegion(0, 0.8, 1, 1, '加入购物车'))
        //     agentOrHidClickOffectY(ocrText('规格'), -100)
        //     agentOrHidClick(ocrTextInRegion(0, 0.8, 1, 1, '加入购物车'))

        //     backUntilFindView(() => {
        //         return ocrTextMoreInRegion(0, 0, 1, 0.8, '立即', '查看详情', '去观看')
        //     }, 5)
        // }

    } else {
        // 
        // reperatAgentSwipSmallDown循环向下浏览(false, 6, 5)
        log('停留一会儿')
        sleep.second(8)
    }

    log('详情浏览结束')
    sleep.second(2)
}


function viewDetail() {
    // 非直播间广告: 游戏详情页/团购详情浏览
    var falgGG = ocrText('下载', '打开')
    if (falgGG) {
        agentOrHidClickOffectY(falgGG, 200, 3, () => {
            reperatAgentSwipSmallDown循环向下浏览(false, 3, 10)

            //找图返回目标数组
            var detectsback = opencv.findImagesEx('图色651156.cv');
            if (detectsback != null) {
                agentOrHidClick(detectsback[0])

                detectsback = opencv.findImagesEx('图色651156.cv');
                if (detectsback != null) {
                    //找图返回目标数组
                    var detectsclose详情 = opencv.findImagesEx('图色662363.cv');
                    if (detectsclose详情 != null) {
                        agentOrHidClick(detectsclose详情[0])
                    }
                }
            } else {
                agentOrHidback()
                sleep.second(1)
            }


        })
    } else {
        start_查看产品详情_SAMPLE()
    }

    backUntilFindView(() => {
        //找图返回目标数组
        return ocrText('反馈', '领取成功', '换一个', '领取奖励', '再看', '后可领奖')
    }, 4, 3)
}